set more 1

/*
File:	cepr_org_realwage.do
Date:	Feb 10, 2009
	Jan 4, 2010
	Feb 22, 2011 CEPR ORG Version 1.6
	Jan 23, 2013 CEPR ORG Version 1.8
	Feb 6, 2014 CEPR ORG Version 1.9
	Mar 12, 2015 CEPR ORG Version 2.0
	Apr  1, 2015, CEPR ORG Version 2.0.1
	March 1, 2016, CEPR ORG Version 2.1
	Oct 12, 2016, CEPR ORG Version 2.1.1
	Feb 9, 2017, CEPR ORG Version 2.2
	Apr 21, 2017, CEPR ORG Version 2.2.1
	Apr 10, 2018, CEPR ORG Version 2.3
	Mar 22, 2019, CEPR ORG Version 2.4
	Jul 24, 2019, CEPR ORG Version 2.4.1
	Feb 05, 2020, CEPR ORG Version 2.5
	
Desc:	Converts nominal to real wages using the CPI-U-RS
*/

capture program drop realw
program define realw
version 7.0
* create real wage variable for analysis
* convert to $2019 using CPI-U-RS
* (see BLS CPI-U-RS table at https://www.bls.gov/cpi/research-series/allitems.pdf)
/* Updated using CPI-U (series CUUR0000SA0) annual averages for 2018 & 2019
from http://www.bls.gov/ accessed Feb 05, 2020.
*/
local basecpi=376.5

local wage "`1'"
gen t`wage'=.
replace t`wage'=`wage'/(114.3/`basecpi') if year==1979
replace t`wage'=`wage'/(127.1/`basecpi') if year==1980
replace t`wage'=`wage'/(139.1/`basecpi') if year==1981
replace t`wage'=`wage'/(147.5/`basecpi') if year==1982
replace t`wage'=`wage'/(153.8/`basecpi') if year==1983
replace t`wage'=`wage'/(160.2/`basecpi') if year==1984
replace t`wage'=`wage'/(165.7/`basecpi') if year==1985
replace t`wage'=`wage'/(168.6/`basecpi') if year==1986
replace t`wage'=`wage'/(174.4/`basecpi') if year==1987
replace t`wage'=`wage'/(180.7/`basecpi') if year==1988
replace t`wage'=`wage'/(188.6/`basecpi') if year==1989
replace t`wage'=`wage'/(197.9/`basecpi') if year==1990
replace t`wage'=`wage'/(205.1/`basecpi') if year==1991
replace t`wage'=`wage'/(210.2/`basecpi') if year==1992
replace t`wage'=`wage'/(215.5/`basecpi') if year==1993
replace t`wage'=`wage'/(220.0/`basecpi') if year==1994
replace t`wage'=`wage'/(225.3/`basecpi') if year==1995
replace t`wage'=`wage'/(231.3/`basecpi') if year==1996
replace t`wage'=`wage'/(236.3/`basecpi') if year==1997
replace t`wage'=`wage'/(239.5/`basecpi') if year==1998
replace t`wage'=`wage'/(244.6/`basecpi') if year==1999
replace t`wage'=`wage'/(252.9/`basecpi') if year==2000
replace t`wage'=`wage'/(260.1/`basecpi') if year==2001
replace t`wage'=`wage'/(264.2/`basecpi') if year==2002
replace t`wage'=`wage'/(270.3/`basecpi') if year==2003
replace t`wage'=`wage'/(277.5/`basecpi') if year==2004
replace t`wage'=`wage'/(286.9/`basecpi') if year==2005
replace t`wage'=`wage'/(296.1/`basecpi') if year==2006
replace t`wage'=`wage'/(304.6/`basecpi') if year==2007
replace t`wage'=`wage'/(316.2/`basecpi') if year==2008
replace t`wage'=`wage'/(315.2/`basecpi') if year==2009
replace t`wage'=`wage'/(320.4/`basecpi') if year==2010
replace t`wage'=`wage'/(330.5/`basecpi') if year==2011
replace t`wage'=`wage'/(337.4/`basecpi') if year==2012
replace t`wage'=`wage'/(342.5/`basecpi') if year==2013
replace t`wage'=`wage'/(348.2/`basecpi') if year==2014
replace t`wage'=`wage'/(348.9/`basecpi') if year==2015
replace t`wage'=`wage'/(353.4/`basecpi') if year==2016
replace t`wage'=`wage'/(361.0/`basecpi') if year==2017
replace t`wage'=`wage'/(369.8/`basecpi') if year==2018
replace t`wage'=`wage'/(376.5/`basecpi') if year==2019
replace t`wage'=`wage'/(376.5*(258.81/255.66)/`basecpi') if year==2020

*
/* Updated using CPI-U (series CUUR0000SA0) annual averages for 2019
from http://www.bls.gov/ accessed Feb 05, 2020.
*/

*
* CEPR CPS ORG preferred wage variable "trims" wage observations
* below $0.50 and above $200 in 1989 constant dollars
*
global dol_b=0.50/(188.6/`basecpi')
global dol_t=200/(188.6/`basecpi')
*
end

/* 
Copyright 2020 CEPR and John Schmitt

This file is part of the cepr_org_master.do program. This file and all
programs referenced in it are free software. You can redistribute the
program or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
USA.
*/
